<template>
	<view class="silver_record">
		<Navbar>日志</Navbar>
		<view class="header">
			<view class="title">参与记录</view>
			<view class="list_title">
				<view class="item">时间</view>
				<view class="item">状态</view>
			</view>
		</view>
		<scroll-view scroll-y class="scroll_view">
			<view class="item" v-for="item in list">
				<view>{{item.created_at}}</view>
				<view>{{item.type_name}}:{{item.value}}</view>
			</view>
			<u-loadmore :status="loadmore_status" :color="$store.state.loadmoreColor"
				:lineColor="$store.state.loadmoreColor" line @loadmore="loadmore" />
		</scroll-view>

	</view>
</template>

<script>
	import {
		pledgeLog
	} from '@/request/api.js';
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.getList();
		},
		methods: {
			async getList() {
				let {
					list
				} = await pledgeLog({
					page: this.page,
					limit: this.limit
				});
				this.last_page = list.last_page;
				list = list.list;
				this.list = this.page == 1 ? list : [...this.list, ...list];
				this.loadmore_status = this.last_page == this.page ? 'nomore' : 'loadmore';
			},
			loadmore() {
				if (this.page < this.last_page) {
					this.page++;
					this.getList();
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	$herderHeight: 170rpx;

	.silver_record {
		height: 100vh;
		background: #29170D;
		overflow: hidden;

		.header {
			height: $herderHeight;
			padding: 40rpx 30rpx 30rpx;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.title {
				color: #FFFFFF;
				font-size: 42rpx;
				font-weight: 400;
				font-family: LiSu;
			}

			.list_title {
				padding: 0 30rpx;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;

				.item {
					color: #FFFFFF;
					font-size: 28rpx;
					font-weight: 400;
					font-family: SimSun;
				}
			}
		}

		.scroll_view {
			height: calc(100vh - #{$navbarHeight} - #{$herderHeight} - 30rpx);
			padding: 30rpx 30rpx 0;
			box-sizing: border-box;

			.item {
				width: 100%;
				height: 60rpx;
				color: #494338;
				font-size: 28rpx;
				font-weight: 400;
				font-family: SimSun;
				margin-bottom: 10rpx;
				padding: 0 30rpx;
				box-sizing: border-box;
				background: url(#{$baseImageUrl}/home/i3.png) no-repeat;
				background-size: 100% 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
			}
		}
	}
</style>